package com.ruoyi.project.business.domain.strategy;

import com.ruoyi.project.business.domain.entity.MonthScheduleEmp;
import com.ruoyi.project.business.domain.entity.ScheduleDefineMirror;
import com.ruoyi.project.business.domain.model.month.MonthScheduleSolution;
import com.ruoyi.project.business.domain.model.month.ShiftDefine;
import com.ruoyi.project.business.domain.ruleengine.CommonMonthScheduleAssignEngine;
import com.ruoyi.project.business.domain.rules.RulesFactory;

import java.util.List;

/**
 * 聚合了哪些 rule 是需要处理的
 */
public class CommonStrategy {
    /**
     *
     * @param emps 员工 + 员工规则
     * @param shiftDefines
     * @return
     */
    public MonthScheduleSolution doScheduleAssign(List<MonthScheduleEmp> emps, List<ShiftDefine> shiftDefines, List<ScheduleDefineMirror> scheduleDefines) {
        new RulesFactory().preDealRules(emps);
        CommonMonthScheduleAssignEngine assignEngine = new CommonMonthScheduleAssignEngine();
        assignEngine.setAimShifts(shiftDefines);
        assignEngine.setEmps(emps);
        assignEngine.setScheduleDefines(scheduleDefines);

        MonthScheduleSolution solution = assignEngine.tryAssign();
        return solution;
    }

}
